import React, { Component } from 'react';
import {glabalContext} from './common/js/globalData'
class Child_ba extends Component{
    //状态 属性
    state ={
        a:20,
        b:12
    }
    render(){
        console.log('this',this)
        return (
            <div className="">
                <h1>子组件child3,使用contextType简化Consumer</h1>   
                {/* 使用contextType读取全局共享数据   */}
                <div>role:{this.context.role}</div>
                <div>amdin:{this.context.email}</div>
                <button onClick={()=>this.context.updateRole("张三")}>
                    context-updateRole-修改role
                </button>
            </div>
        )
    }
}
Child_ba.contextType = glabalContext
export default Child_ba;